﻿using System;
using System.Collections.Generic;

namespace SharpTrainer.Util
{
    public class GenericUtil<T>
    {
        public static void PrintLinkedList(LinkedList<T> lst)
        {
            foreach (T elem in lst)
                Console.Write("{0} ", elem.ToString());

            Console.WriteLine();
            Console.WriteLine("******************************************");
        }

        public static void PrintHashSet(HashSet<T> set)
        {
            foreach (T elem in set)
                Console.Write("{0} ", elem.ToString());

            Console.WriteLine();
            Console.WriteLine("******************************************");
        }

        public static void ListAll(IList<T> lst)
        {
            foreach (T elem in lst)
                Console.Write("{0} ", elem.ToString());

            Console.WriteLine();
            Console.WriteLine("******************************************");
        }

        public static void PrintEnumerable(IEnumerable<T> lst)
        {
            var enumerator = lst.GetEnumerator();
            while (enumerator.MoveNext())
            {
                Console.WriteLine("{0}", enumerator.Current.ToString());
            }

            Console.WriteLine();
            Console.WriteLine("******************************************");
        }
    }
}
